<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // let obj = Object.defineProperty({name:"老王"},"age",{
        //     value:18,
        //     writable:true,
        //     configurable:true,
        //     enumerable:true
        // });

        // obj.age = 23;

        // delete obj.age;

        // console.log(obj);

        let s;
        let obj2 = Object.defineProperties({name:"小李"},{
            age:{
                value:66
            },
            sex:{
                get:()=>{
                    return s || "男";
                },
                set:(val)=>{
                    s = val;
                }
            }
        })

        obj2.sex = '女'
        console.log(obj2);

    </script>
</body>
</html>